From c276f53796158d2ed025861f9d9e10eaeee3a279 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 24 Nov 2011 18:38:53 +0100 Subject: [PATCH] Make computed value of border-width 0 if border-style none From the css docs at http://www.w3.org/TR/CSS2/box.html: 8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', and 'border-width' Computed value: absolute length; '0' if the border style is 'none' or 'hidden' --- gtk/gtkstylecontext.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index b2993ecfee..82cec95d81 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -3347,6 +3347,7 @@ gtk_style_context_get_border (GtkStyleContext *context, GtkStyleContextPrivate *priv; StyleData *data; int top, left, bottom, right; + GtkBorderStyle border_style; g_return_if_fail (border != NULL); g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); @@ -3357,16 +3358,27 @@ gtk_style_context_get_border (GtkStyleContext *context, data = style_data_lookup (context); gtk_style_properties_get (data->store, state, + "border-style", &border_style, + "border-top-width", &top, "border-top-width", &top, "border-left-width", &left, "border-bottom-width", &bottom, "border-right-width", &right, NULL); - - border->top = top; - border->left = left; - border->bottom = bottom; - border->right = right; + if (border_style == GTK_BORDER_STYLE_NONE) + { + border->top = 0; + border->left = 0; + border->bottom = 0; + border->right = 0; + } + else + { + border->top = top; + border->left = left; + border->bottom = bottom; + border->right = right; + } } /** -- 2.30.2